const mongoose = require('mongoose')

mongoose.connect('mongodb://localhost/blogProject')

// 判断数据库连接状态
mongoose.connection.on('error', console.error.bind(console, 'connection error:'))
mongoose.connection.once('open', () => {
  console.log('数据库连接成功！')
})

module.exports = mongoose
